package com.miku.blog.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.miku.blog.domain.Website;
import com.miku.blog.domain.pojo.SystemConstance;
import com.miku.blog.mapper.WebsiteMapper;
import com.miku.blog.service.WebsiteService;
import org.springframework.stereotype.Service;


/**
* @author Miku
* @description 针对表【tb_website_cfg】的数据库操作Service实现
* @createDate 2022-06-08 08:47:10
*/
@Service
public class WebsiteServiceImpl extends ServiceImpl<WebsiteMapper, Website>
    implements WebsiteService {

    @Override
    public Website getWebSite() {
        LambdaQueryWrapper<Website> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(Website::getId, SystemConstance.WEBSITE_ID);
        return getOne(queryWrapper);
    }


    @Override
    public boolean updateWebsite(Website website) {
        LambdaUpdateWrapper<Website> updateWrapper = new LambdaUpdateWrapper<>();
        updateWrapper.eq(Website::getId,SystemConstance.WEBSITE_ID);
        return update(website,updateWrapper);
    }
}




